package Controllers
{
	import Models.Model;

	public class Controller
	{
		[Bindable]
		public var selectedType : Object;
		
		[Bindable]
		public var selectedOperation : Object;
		
		[Bindable]
		public var x : String = "0";
		
		private var model : Model;
		
		public function Controller()
		{
			model = new Model();
		}
		
		public function GetModel() : Model
		{
			return model;
		}
		
		public function onInit() : void
		{
			model.Init();
		}
		
		public function onSelectType () : void
		{
			if (selectedType != null)
			{	
				model.SelectType(selectedType.toString());
			}
		}
		
		public function onSelectOperation () : void
		{
			if (selectedOperation != null)
			{
				model.SelectSquare(selectedOperation.toString(), int(x));
			}
		}
		
		public function onSendSelection() : void
		{
			model.SendSelection();
		}
	}
}